<?php include './admin/view/header.inc.htm'; ?>

<div class="panel">
	<div class="header">Sphinx 搜索服务设置</div>
	<div class="body">
		<form method="POST" id="form" action="plugin/xn_sphinx/setting.php">
			<table class="form">
				<tr>
					<th style="width: 200px;">是否开启 Sphinx 搜索：</th>
					<td>
						<?php echo $input['enable']; ?>
					</td>
				</tr>
				<tr>
					<th valign="top">Sphinx 主机：</th>
					<td>
						<?php echo $input['sphinx_host']; ?>
					</td>
				</tr>
				<tr>
					<th>Sphinx 端口：</th>
					<td>
						<?php echo $input['sphinx_port']; ?>
					</td>
				</tr>
				<tr>
					<th>Sphinx 数据源：</th>
					<td>
						<?php echo $input['sphinx_datasrc']; ?>
					</td>
				</tr>
				<tr>
					<th>Sphinx 增量索引数据源：</th>
					<td>
						<?php echo $input['sphinx_deltasrc']; ?>
					</td>
				</tr>
				<tr>
					<th>&nbsp;</th>
					<td>
						<button type="submit" id="submit" loading-text="正在提交" class="blue big">确定</button>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>
<p>如何安装 Sphinx：<a href="http://bbs.xiuno.com/thread-18.htm" target="_blank">http://bbs.xiuno.com/thread-18.htm</a></p>
<p>Sphinx 官方：<a href="http://sphinxsearch.com/" target="_blank">http://sphinxsearch.com/</a></p>

<?php include './admin/view/footer.inc.htm'; ?>
<script>

var jform = $("#form");
var jsubmit = $("#submit");

jform.on('submit', function(){
	var postdata = jform.serialize();
	jsubmit.button('loading');
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			jsubmit.text(message);
			setTimeout(function(){ jsubmit.button('reset'); }, 1000);
			return;
		} else {
			$.alert(message);
			jsubmit.button('reset');
		}
	});
	return false;
});
</script>